﻿using System;
using System.Collections;
using System.Windows.Forms;

namespace Maze
{
    public class HighScoreItem : ListViewItem
    {
        private int score = 0;

        public HighScoreItem(string name, int score)
        {
            this.SubItems.Add(name);
            this.score = score;
            this.Text = this.score.ToString();
        }

        public int Compare(HighScoreItem other)
        {
            return (other.score - this.score);
        }
    }

    public class HighScoreComparer : IComparer
    {
        #region IComparer Members

        public int Compare(object x, object y)
        {
            HighScoreItem itemX = x as HighScoreItem;
            HighScoreItem itemY = y as HighScoreItem;
            return itemX.Compare(itemY);
        }

        #endregion
    }
}
